package test;

import java.util.Scanner;

public class DayKLeft2 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int month = scan.nextInt();
		int day = scan.nextInt();
		int sum = 0;
		int left = 0;
		switch(month) {
		case 12: 
			sum+=30;
		case 11:
			sum+=31;
		case 10:
			sum+=30;
		case 9:
			sum+=31;
		case 8:
			sum+=30;
		case 7:
			sum+=31;
		case 6:
			sum+=30;
		case 5:
			sum+=31;
		case 4:
			sum+=30;
		case 3:
			sum+=28;
		case 2:
			sum+=31;
		case 1:
			sum+=day;
		}
		left = 365 - sum;
		System.out.println("过去了" + sum);
		System.out.println("还剩" + left);
 	}
}
